Ycopy Logo

« Previous
Top
Next »
Copy Rules List

The copy rules list allows you to specify with a great deal of flexibility exactly which files and folders you want Ycopy to copy and which ones you'd like it to leave alone.

This feature makes use of regular expressions.  Regular expressions are a powerful mechanism for text matching.  Unfortunately, they can also be very confusing if you've never seen them before.  Actually sometimes they can be confusing even if you have seen them before! :-).  Don't worry, though, because even if you don't want to learn how to regular expressions you can still use the predefined Ycopy copy rule files available for download on www.ruahine.com.

To access the copy rules list from the main Ycopy dialog click the options button at the bottom.  The Ycopy options window will then pop up.  Select the "Copy Rules List" tab and you should see a window like the one below (figure 1).

graphic
Figure 1) Copy Rules List window.

The top checkbox enables use of the file copy rules in the edit field below it. The middle checkbox enables use of the folder copy in the edit field below it. The last checkbox specifies whether rule matches should be case sensitive or not.  Probably best to leave that alone for now.  The rest of the dialog lets you load previously saved copy rule files, save the current copy rules to a file and provides a quick way to clear both sets of rules.

Rule syntax.

Each rule starts with either the letter "C" or the letter "D".  This specifies the action that is to be taken when this rule matches either the current file being copied or the current folder being copied.

C - Action: Copy the file or folder
D - Action: Don't copy the file or folder

Everything after the first letter is part of a regular expression which defines the pattern to be matched.  In the case of figure 1 above the logic of the rules is as follows.

C\.jpg$  - Copy all files that end with ".jpg".
C\.gif$       - Copy all files that end with ".gif".
D      - Policy rule.  Don't copy files that didn't match any of the rules above.

For more information on the regular expression syntax supported by Ycopy see Appendix A - Regular Expression Syntax.

Important: The last rule can be a single letter "C" or "D".  This specifies what to do in the case that no rules match.  E.g. "C" will copy by default and "D" will not copy by default.  You can only have one such "policy" rule and it must be at the end of all the other rules (if it is omitted the default policy is to copy the file or folder).  Also there should be no blank lines in the rules list.

Important: You must check the checkboxes "Enable File/Folder Copy Rules List" or the rules in the edit box below will not be applied during the copy.

If you want to use a specific rule file each time you start Ycopy then load it and set the "Enable File/Folder Copy Rules List" checkboxes appropriately before going to the "General" tab and clicking the button "Save All Settings".

Confused? Some Examples

Perhaps some examples will help explain this.

- Copying images only out of a folder.

This can be accomplished with a ruleset as given in figure 1.

- Skipping temporary files and the Internet Browser Cache.

File rules
D\.tmp$
C

Folder rules
D\\Temporary Internet Files\\$
C

Explanation

This would copy all files except ".tmp" files and all folders except the folder "Temporary Internet Files".

Note: The trailing \\ must be there when matching folders using $ to match the end of the folder name.

- Reproducing a directory structure without the files.

File rules
D

Folder rules
C

Explanation

This ruleset will recreate the directory structure.  Basically it just says don't copy any files but do copy all the folders.

- Copying out of a cvs repository.

File rules
D~$
C

Folder rules
D\\CVS\\$
C

Explanation

This ruleset will copy files out of a CVS respository ignoring "backup" files that end in ~ and any folder with the name "CVS".

Need help? Found a bug?

Send me an email support@ruahine.com

« Previous
Top
Next »
Copyright ⌐ 2003-2006. All rights reserved. Ruahine.com Software. License and usage terms.